from django.db import models

# Create your models here.
class Dianjia(models.Model):
    name = models.CharField(max_length=20)
    def __str__(self):
        return self.name
class Shangping(models.Model):
    name = models.CharField(max_length=20)
    piice = models.DecimalField(max_digits=7,decimal_places=2)
    tupian = models.ImageField(null=True)
    cate = models.ForeignKey(to='Dianjia',on_delete=models.CASCADE)
    def __str__(self):
        return self.name
